<template>
  <ConfigProvider :theme="app.themeConfig" prefixCls="ant" :locale="getAntdLocale">
    <AppProvider>
      <RouterView />
    </AppProvider>
  </ConfigProvider>
</template>

<script lang="ts" setup>
  import { ConfigProvider } from 'ant-design-vue';
  import { AppProvider } from '/@/components/Application';
  import { useTitle } from '/@/hooks/web/useTitle';
  import { useLocale } from '/@/locales/useLocale';
import { useAppStore } from '/@/store/modules/app'

  import 'dayjs/locale/zh-cn';
  import 'dayjs/locale/zh-tw';
  // support Multi-language
  const { getAntdLocale } = useLocale();
  // Listening to page changes and dynamically changing site titles
  useTitle();
  
  const dark = window.localStorage.getItem('__APP__DARK__MODE__');
  const app = useAppStore()
  app.setDarkMode(dark || 'light')

  // 阻止火狐浏览器在拖动时打开新窗口
  document.body.ondrop = function (event) {
    event.preventDefault();
    event.stopPropagation();
  };
</script>
